package cn.tansanqinger.controller.account;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import cn.tansanqinger.service.hymenu.IHyMenuServer;
import cn.tansanqinger.service.topic.ITopicService;
import cn.tansanqinger.util.Tools;

@Controller
@RequestMapping("/account/user")
public class AccountCollectController {

	@Autowired
	private IHyMenuServer hyMenuServer;
	@Autowired
	private ITopicService service;
	
	@RequestMapping("/collect")
	public ModelAndView list(ModelAndView mv, HttpServletRequest request) {
		mv = hyMenuServer.selectHyMenuAll(mv);
		mv.addObject("user", request.getSession().getAttribute("user"));
		mv.addObject("collectTopics", service.selectMessage(request));
		mv.addObject("count", service.numberCollect(request));
		mv.addObject("page", Tools.isEmpty(request.getParameter("page")));
		mv.setViewName("account/collect");
		return mv;
	}
}
